Skip to content

CI: build and test with GitHub Actions + fix two stale csnode tests - #1

Merged
EnzinoBB merged 5 commits into
masterfrom
ci/github-actions-build
Oct 7, 2026
Merged

EnzinoBB merged 5 commits into
masterfrom
ci/github-actions-build

Conversation

@EnzinoBB

@EnzinoBB EnzinoBB commented Oct 7, 2026 •

Copy link
Copy Markdown
Collaborator

What changes

Two separate commits. Production code is not touched.

1. tests: fix two stale csnode tests so nodetests builds again

The nodetests target no longer compiled, so none of the csnode unit tests could run.

  • tests/csnode/conveyer_tests.cpp: PoolMetaInfo gained a reward field after timestamp, so the test's aggregate initializer was shifted by one. Pass an empty reward. applyCharacteristic adds the reward field only when it is non-empty, so the expectations are unchanged.
  • tests/csnode/poolsynchronizer_tests.cpp: PoolSynchronizer::neighbours() was removed in 3ed6b98 (new synchronization algorithm). Neighbours are now a private unordered_map, so the "sorted by sequence" invariant no longer exists. Remove the helper and its assertion from the already DISABLED_ test, with a comment explaining why.

2. ci: build the node and run tests with GitHub Actions

Adds only .github/workflows/build.yml:

  • Triggers: push to master (i.e. PR merge), pull requests to master, manual (workflow_dispatch).
  • Environment: Ubuntu 24.04, GCC 13, Ninja + ccache, Release, ENABLE_TESTS=ON.
  • Boost 1.83: built as static libraries with a static runtime, because the CMake files set Boost_USE_STATIC_RUNTIME and distro packages don't provide that. The source tarball is checked with sha256, and the build is cached between runs.
  • Submodules: initialised by explicit path, because the orphan gitlink third-party/rocksdb (no .gitmodules entry) makes a recursive update fail.
  • Missing includes: -include cstdint -include cstddef works around includes that GCC 13 no longer pulls in transitively (third-party base58, csnode/bitheap.hpp), without touching the sources.
  • Output: tests run with ctest, and the node binary is uploaded as an artifact (30 days).

Later commits on this PR disable Thrift's Haskell library on the runner, keep the caches on failure, add a disk-usage report and a per-test timeout, and fix LockFreeChanger.BaseUsageSimple (an infinite loop in the test).

Local verification

nodetests 110/110, lmdbxxtests 13/13, lib_system 49/49.

🤖 Generated with Claude Code

EnzinoBB and others added 5 commits October 7, 2026 17:03
The nodetests target no longer compiled, so none of the csnode unit tests could run.
Test-only change: production code is untouched.

- conveyer_tests: PoolMetaInfo gained a `reward` field after `timestamp`, so the
  aggregate initializer was shifted by one. Pass an empty reward; applyCharacteristic
  adds the reward user field only when it is non-empty, so expectations are unchanged.
- poolsynchronizer_tests: PoolSynchronizer::neighbours() was removed in 3ed6b98
  (new synchronization algorithm). Neighbours are now a private unordered_map, so the
  "sorted by sequence" invariant no longer exists. Drop the helper and its assertion
  from the already DISABLED test, with a comment explaining why.

Result with ENABLE_TESTS=ON (GCC 13, Boost 1.83 static): nodetests 110/110,
lmdbxxtests 13/13 and lib_system 49/49 pass.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Adds one workflow that builds the node on Linux and runs the unit tests:
- on push to master, i.e. when a PR is merged;
- on pull requests to master, so a change is checked before merge;
- on demand (workflow_dispatch).

Nothing outside .github/ changes.

Build recipe (same as the one verified locally):
- Ubuntu 24.04, GCC 13, Ninja + ccache, Release, ENABLE_TESTS=ON.
- Boost 1.83 is built from the verified source tarball as static libs with a
  static runtime, because the CMake files set Boost_USE_STATIC_RUNTIME, which
  distro packages do not provide. It is cached between runs.
- Submodules are initialised by explicit path: the orphan third-party/rocksdb
  gitlink (no .gitmodules entry) makes a plain recursive update fail.
- CMAKE_CXX_FLAGS "-include cstdint -include cstddef" works around missing
  includes that GCC 13 exposes in third-party base58 and csnode/bitheap.hpp,
  without touching the sources.
- Tests run with ctest. The node binary is uploaded as an artifact (30 days).

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
…sage

First CI run: every node and test target built (365/366). The one failure was
Thrift's Haskell library. The ubuntu-24.04 image ships GHC/cabal, so Thrift
turns WITH_HASKELL on by itself. The node does not use it, so pass
-DWITH_HASKELL=OFF from the workflow; the project's CMake files are unchanged.

Also:
- Split actions/cache into restore + save, so the Boost and ccache caches are
  kept even when a later step fails (the post-step save is skipped on failure).
- Add a final "Disk usage" step (always runs) that prints free space and the size
  of the workspace, the build dir, Boost and ccache.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
In run 37643122295 the build passed, but the Test step was still running after
more than 20 minutes. Locally the same three suites finish in about 35 s, also
on 2 cores with no stdin. GitHub does not expose the job log until the job ends,
so make the hang visible:
- ctest --timeout 300 kills a stuck test and --output-on-failure prints what it
  logged up to that point;
- step timeout-minutes: 20 so the runner is not held for the job's 3 hours.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This made the `system` suite hang on the GitHub runner (ctest timeout at 300 s
in run 37647459022). Test-only change: production code is untouched.

- The writer generated a value "different from previous" with
  `do { ... } while (randomValue != previous.data())`. The condition is
  inverted: on the first pass previous is 0 and values are drawn from
  [1, INT_MAX], so the loop never ends. Locally the writer thread usually
  started after `isRunning` was already false, which hid the bug; on the runner
  it started first and spun forever. Use `==`.
- With the loop fixed, a second race became visible: the reader's
  wait_for(250 ms) can time out before the writer stored anything, and then
  `desired != previous` compares 0 with 0. Only assert once a value has been
  written.

Locally: 3000/3000 repetitions pass, and 1000/1000 with every core busy.
Before the fix it hung within 4 repetitions.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@EnzinoBB
EnzinoBB merged commit b57b82b into master Oct 7, 2026
1 check passed
@EnzinoBB EnzinoBB changed the title CI: build e test automatici con GitHub Actions + fix di due test csnode obsoleti CI: build and test with GitHub Actions + fix two stale csnode tests Oct 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant